package com.zbc.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zbc.domain.entity.Picture;
import com.zbc.domain.entity.User;
import com.zbc.domain.request.picture.PictureEditRequest;
import com.zbc.domain.request.picture.PictureQueryRequest;
import com.zbc.domain.request.picture.PictureReviewRequest;
import com.zbc.domain.request.picture.PictureUploadRequest;
import com.zbc.domain.vo.PictureVO;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author fangyu
 * @version v1.0.0
 * @since 2025/9/2 14:17
 */
public interface PictureService extends IService<Picture> {
    /**
     * PictureVO 转 Picture
     *
     * @param pictureVO pictureVO
     * @return Picture
     */
    Picture getPicture(PictureVO pictureVO);

    /**
     * Picture 转 PictureVO
     *
     * @param picture picture
     * @return PictureVO
     */
    PictureVO getPictureVO(Picture picture);

    /**
     * 上传图片
     *
     * @param multipartFile 本地文件 / URL
     * @param uploadRequest 上传参数
     * @param loginUser     当前登录用户
     * @return 图片信息(脱敏)
     */
    PictureVO uploadPicture(MultipartFile multipartFile, PictureUploadRequest uploadRequest, User loginUser);

    /**
     * 删除图片
     *
     * @param pictureId 图片 id
     * @param loginUser 当前登录用户
     */
    void deletePicture(long pictureId, User loginUser);

    /**
     * 图片校验规则
     *
     * @param picture 图片
     */
    void validPicture(Picture picture);

    /**
     * 封装图片的分页查询条件
     *
     * @param request 查询参数
     * @return 查询条件
     */
    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest request);

    /**
     * 获取图片的 VO(处理 UserVO)
     *
     * @param picture 图片
     * @return 图片的 VO
     */
    PictureVO getPictureVOWithUserVO(Picture picture);

    /**
     * 分页获取图片的 VO (处理 UserVO)
     *
     * @param picturePage 图片的分页数据
     * @return 图片的 VO
     */
    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage);

    /**
     * 用户图片编辑
     *
     * @param request   图片编辑请求
     * @param loginUser 登录用户
     */
    void editPicture(PictureEditRequest request, User loginUser);

    void dePictureReview(PictureReviewRequest request, User loginUser);

    void fillReviewParams(Picture picture, User loginUser);
}
